well, this is what I have
Code:
int saveListNewName(char *filename)
{
FILE *fptr;
int i;
char *fileAddress;
//fprintf(stdout,"Saving records to %s\n", filename);
printf("file name is >> %s\n",filename);
fptr = fopen(filename,"wb");
....
}
the filename string is ":abcd"
and this is the the output from the printf -> file name is >> :abcd
and fopen succeed in opening the file (creating it)
this is the rest of my function
Code:
....
if (fptr == NULL)
{
fprintf(stderr, "Could not save to %s - %s\n",
filename, sys_errlist[errno]);
return 0;
}
for (i = 0; i < count; i++)
{
if (fwrite(cdPointers[i], sizeof(cd_t), 1, fptr) < 1)
{
fprintf(stderr, "Could not write to %s - %s\n",
filename, sys_errlist[errno]);
return 0;
}
}
puts("File have been saved");
fileAddress = getDir(filename);
printf("File have been saved to %s",fileAddress);
free(fileAddress);
fclose(fptr);
return 1;
}
[/code]